<template match="//groupname" group="" prefix="Méthodes">
    <switch test="$group">
        <case test="action">Actions de ce module</case>
        <case test="private">$prefix privées</case>
        <case test="protected">$prefix protégées</case>
        <case test="public">$prefix publiques</case>
        <default>$group ???</default>
    </switch>
</template>
<template match="//annotations" a="">
    <if test="$a">
        <loop on="$a" as="$tag,$item">
            <switch test="{strtolower($tag)}">
                <case test="throws">
                    <h4>{str_replace('(s)', count($item)==1 ? '' : 's', 'Exception(s) générée(s) :')}</h4>
                    <ul>
                        <loop on="$item" as="$doc">
                            <li><p><span class="type">{AutoDoc::link($doc->name)}</span> {$doc->shortDescription}</p>{$doc->longDescription}</li>
                        </loop>
                    </ul>
                </case>
                
                <case test="see">
                    <h4>Voir aussi :</h4>
                    <ul>
                        <loop on="$item" as="$doc">
                            <li><p><span class="type">{AutoDoc::link($doc->name)}</span> {$doc->shortDescription}</p>{$doc->longDescription}</li>
                        </loop>
                    </ul>
                </case>

                <case test="tutorial">
                    <h4>Voir aussi :</h4>
                    <ul>
                        <loop on="$item" as="$doc">
                            <li><p><a href="?filename={$doc->name}">{$doc->shortDescription ? $doc->shortDescription :$doc->name}</a></p>{$doc->longDescription}</li>
                        </loop>
                    </ul>
                </case>

                <case test="var">
                    <loop on="$item" as="$doc">
                        {$doc->shortDescription} {$doc->longDescription}
                        <p>
                            Type : <span class="type">{$doc->name}.</span>
                        </p>
                    </loop>
                </case>
                
                <case test="todo">
                    <div class="warning">
                    <div class="title">Evolution prévue</div>
                        <loop on="$item" as="$doc">
                            <p>{$doc->name} {$doc->shortDescription}</p>{$doc->longDescription}
                        </loop>
                    </div>
                </case>
                
                <default>
                    <h4>$tag</h4>
                    <ul>
                        <loop on="$item" as="$doc">
                            <li><p><span>{$doc->name}</span> {$doc->shortDescription}</p>{$doc->longDescription}</li>
                        </loop>
                    </ul>
                </default>
            </switch>
        </loop>
    </if>
</template>

<form action="" style="border: 1px solid #008; background-color: #eee; padding: 5px; float: right; width: 70px; font-size: 11px;">
    <div>
        Afficher : <br />
        <hidden name="class" value="{$class->name}" />
        <loop on="{$this->getFlags()}" as="$flag,$defaultValue">
            <checkbox name="$flag" value="true" label="$flag" checked="{Config::get('show.'.$flag) ? 'checked' : ''}"/><br />
        </loop>
        <submit label="»»»" />
    </div>
</form>

<div class="sect1">
    <h1>Documentation {$class->isModule() ? 'du module' : 'de la classe'} {$class->name}</h1>

    <opt><div style="font-weight: bold; font-size: 120%;">{$class->summary}</div></opt>

    {$class->description}

    <annotations a="{$class->annotations}" />
    
    <if test="{$class->ancestors}">
        <h4>Diagramme d'héritage de cette classe</h4>
        <div class="hierarchy">
            <def name="fontsize" value="100" />
            <loop on="{array_reverse($class->ancestors)}" as="$ancestor">
                <span style="border: 1px solid #444; background: #eee; padding: 0.5em; font-size: $fontsize%">
                    {AutoDoc::link($ancestor)}
                </span>
                <code style="background-color: transparent; padding: 0 0.5em;">---&gt;</code>
                <def name="fontsize" value="{$fontsize+30}" />
            </loop>
            <span style="border: double #444; background: yellow; padding: 0.5em; font-weight: bold; font-size: $fontsize%;">{$class->name}</span>
        </div>
    </if>

    <div class="sect2" test="{$class->constants}">
        <h2>Constantes définies par la classe</h2>
        <dl>
            <loop on="{$class->constants}" as="$constant">
                <dt id="{$constant->name}">
                    <span class="keyword">Const</span>
                    <span class="value" style="font-weight: bold;">{$constant->name}</span>
                    <span class="operator">=</span>
                    <code>{htmlspecialchars($constant->value)}</code>
                    ({$constant->type})
                </dt>
                <dd>
                </dd>
            </loop>
        </dl>
    </div>
    
    <div class="sect2" test="{$class->properties}">
        <h2>Propriétés</h2>
        <loop on="{$class->properties}" as="$group,$properties">
            <div class="sect3">
                <h3><groupname group="$group" prefix="Propriétés" /></h3>
                <dl>
                    <loop on="{$properties}" as="$property">
                        <dt>
                            <a href="#{$property->name}">{$property->name}</a>
                        </dt>
                        <dd> 
                            {$property->summary}
                        </dd>
                    </loop>
                </dl>
            </div>
        </loop>
    </div>
    
    <div class="sect2" test="{$class->methods}">
        <h2>Méthodes</h2>
        <loop on="{$class->methods}" as="$group,$methods">
            <div class="sect3">
                <h3><groupname group="$group" /></h3>
                <dl>
                    <loop on="{$methods}" as="$name,$method">
                        <dt>
                            <a href="#$name">$name</a>
                        </dt>
                        <dd>
                            {$method->summary}
                        </dd>
                    </loop>
                </dl>
            </div>
        </loop>
    </div>
    
    <if test="{$class->properties}">
        <loop on="{$class->properties}" as="$group,$properties">
            <hr />
            <groupname group="$group" prefix="Détail des propriétés" />
            <hr />
            <loop on="{$properties}" as="$property">
                <div class="sect2">
                    <h2 id="{$property->name}">{$property->name}</h2>
                    {$property->summary}{$property->description}
                    <annotations a="{$property->annotations}" />
                </div>
            </loop>
        </loop>
    </if>

    <if test="{$class->methods}">
        <loop on="{$class->methods}" as="$group,$methods">
            <hr />
            <groupname group="$group" prefix="Détail des méthodes" />
            <hr />
            <loop on="{$methods}" as="$name,$method">
                <div class="sect2">
                    <span style="float: right">
                        <if test="{$method->inheritedFrom}">
                            Héritée de {AutoDoc::link($method->inheritedFrom, $method->name)}
                        </if>
                        <if test="{$method->overwrites}">
                            Surcharge {AutoDoc::link($method->overwrites, $method->name, $method->overwrites.'::'.$method->name.'()')}
                        </if>                    
                    </span>
                    <h2 id="$name">$name()</h2>
                    
                    <div class="programlisting">{$method->signature}</div>
                    <div style="font-weight: bold">{$method->summary}</div>
                    {$method->description}
                    
                    <if test="{$method->parameters}">
                        <h4>Paramètre{count($method->parameters)==1 ? '' : 's'} : </h4>
                        <ul>
                            <loop on="{$method->parameters}" as="$parameter">
                                <li>
                                    <p>
                                        <span class="var">{$parameter->name}</span>
                                        <span class="type">({$parameter->type}<if test="{!is_null($parameter->default)}">, optionnel</if>)</span>
                                        <opt> : {$parameter->summary}</opt>
                                    </p> 
                                    {$parameter->description}
                                </li>
                            </loop>
                        </ul>
                    </if>
                    
                    <if test="{$method->return}">
                        <h4>Valeur de retour : </h4>
                        <ul>
                            <li>
                                <p>
                                    <span class="type">{$method->return->type}</span>
                                    <opt>: {$method->return->summary}</opt>
                                 </p>
                                {$method->return->description}
                            </li>
                        </ul>
                    </if>
                    
                    <annotations a="{$method->annotations}" />
                </div>
            </loop>
        </loop>
    </if>
</div>

<div test="{$errors and Config::get('show.errors')}" style="color: red; border: 1px solid red; background: yellow;">
    <h2>Erreurs rencontrées lors de la génération de cette documentation : </h2>
    <ul>
        <loop on="$errors" as="$error">
            <li>$error</li>
        </loop>
    </ul>
</div>

<p style="text-align: center; color: #888; border-top: 1px solid #888; font-size: 0.8em;">
    Documentation générée le {date('d/m/Y à H:i:s')}.
    Dernière modification le {date('d/m/Y à H:i:s', $class->lastModified)}.
</p>